<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>

</head>
<body>
  <div id="box"></div>
  <script>
    var data =[];
    $.ajax({
      // 使请求同步，默认为true异步
      async:false,
      url:'https://www.banyuan.club/api/category/list',
      type:'GET',
      success:function(response){
        console.log(response);
        data=response.data.list;
        console.log(data);
    //     var a=$('#box');
    // for(var i=0;i<data.length;i++){
    //   console.log(data[i].title)
    //   a.append(`
    //   <p>${data[i].title}</p>
    //   `)
    // }
      },
      error:function(request){
        console.log(request);
      }
    })
    var a=$('#box');
    for(var i=0;i<data.length;i++){
      console.log(data[i].title)
      a.append(`
      <p>${data[i].title}</p>
      `)
    }
  </script>
</body>
</html>